package cn.com.xuxiaowei.server.service.impl;

import cn.com.xuxiaowei.server.bo.UserBo;
import cn.com.xuxiaowei.server.service.UserService;
import cn.com.xuxiaowei.server.vo.UserInfoVo;
import cn.com.xuxiaowei.server.vo.UserVo;
import org.springframework.stereotype.Service;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.SOAPBinding;

/**
 * 用户 WebService 接口
 *
 * @author 徐晓伟
 */
@Service
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
@WebService(targetNamespace = "http://service.xuxiaowei.com.cn")
public class UserServiceImpl implements UserService {

    /**
     * 根据 用户ID 查询用户
     *
     * @param userBo 用户ID
     * @return 返回 用户
     */
    @Override
    @WebMethod
    @WebResult(name = "response")
    public UserVo getById(@WebParam(name = "request") UserBo userBo) {
        String id = userBo.getId();

        UserVo userVo = new UserVo();
        userVo.setId(id);
        userVo.setUsername("用户-" + id + "用户123");
        userVo.setPassword("用户-" + id + "-密码");
        return userVo;
    }

    @Override
    @WebMethod
    @WebResult(name = "userVo")
    public UserInfoVo getByUserInfo(@WebParam(name = "userId") String userId) {
        UserInfoVo userVo = new UserInfoVo();
        userVo.setId(userId);
        userVo.setAddress("地址-" + userId);
        userVo.setTel("电话-" + userId);
        return userVo;
    }

}
